﻿using INTEX.DataBase.Tools;
using System.ComponentModel;
using System.Data;
using System.Data.OracleClient;
using System.Data.SqlClient;
using System.Windows.Threading;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{
    public class NotifyBase : DispatcherObject,INotifyPropertyChanged
    {
        #region==============INotifyPropertyChanged===============
        public object Tag;
        public event PropertyChangedEventHandler PropertyChanged;

        public virtual void OnPropertyChanged(string propertyName, object value)
        {
            this.Tag = value;
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        public virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;

            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
        public OracleCommand or1;

        public DataSet SetEnv { get; set; }

        public DataSet SetData
        {
            get;
            set;
        }

        public DataSet SetProd
        {
            get;
            set;
        }

        private string _Name; public string Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name", value); } }
        private string _TableName; public string TableName { get { return _TableName; } set { _TableName = value; OnPropertyChanged("TableName", value); } }
        public bool IsMaster
        {
            get
            {
                return app.IsMaster;
            }
            set
            {
                app.IsMaster = value;
                OnPropertyChanged("IsMaster", value);
            }
        }
        private string _AppMode = "";
        public string AppMode
        {
            get { return _AppMode; }
            set
            {
                _AppMode = value;
                OnPropertyChanged("AppMode", value); 
            }
        } 
        public string LANG
        {
            get { return app.LANG; }
            set
            {
                app.LANG = value;
                OnPropertyChanged("LANG", value);
            }
        }
        
        public ApplicationBase app { get { return ApplicationBase.Instance; } }

        public INTEXDBC INTEXDBC { get { return app.INTEXDBC; } }
        public INTEXBL INTEXBL { get { return app.INTEXBL; } }
        public OracleConnection OracleDB { get { return app.OracleDB; } }
        public string TERMNO { get { return app.TERMNO; } }

        public DataSet Connect2Proxy(OracleCommand oracmd, string CommandType)
        {
            return INTEXDBC.Connect2Proxy(oracmd, CommandType);
        }
        public DataSet Connect2Proxy(OracleCommand oracmd)
        {
            return INTEXDBC.Connect2Proxy(oracmd);
        }
        public DataSet Connect2Proxy(ITXConnectInfo client)
        {
            return INTEXDBC.Connect2Proxy(client);
        }
        public DataSet Connect2Proxy(SqlCommand sqlcommand)
        {
            return INTEXDBC.Connect2Proxy(sqlcommand);
        }
        public void BlindMap(ref DataRow dwLocal, DataRow dwData)
        {
            INTEXDBC.BlindMap(ref dwLocal, dwData);
        }

        public NotifyBase()
        {

        }

    }
}
